package skiree.host.abetsy.api.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import skiree.host.abetsy.api.service.ConfigService;
import skiree.host.abetsy.api.vessel.Result;

import javax.annotation.Resource;
import java.util.Objects;

@Controller
@CrossOrigin
@RequestMapping("/api/private/v1")
public class ConfigController {

    @Resource
    private ConfigService configService;

    @GetMapping("/config/info")
    @ResponseBody
    public Result settingInfo() {
        return configService.settingInfo();
    }

    @PostMapping("/config/sync/priority")
    @ResponseBody
    public Result syncPriority(@RequestBody String priorityStr) {
        return configService.syncPriority(priorityStr);
    }

    @PostMapping("/config/sync/expand")
    @ResponseBody
    public Result syncExpand(@RequestBody String expandStr) {
        return configService.syncExpand(expandStr);
    }

    @PostMapping("/config/sync/episodeSort")
    @ResponseBody
    public Result syncEpisodeSort(@RequestBody String episodeSortStr) {
        return configService.syncEpisodeSort(episodeSortStr);
    }

    @PostMapping("/config/sync/threadPool")
    @ResponseBody
    public Result syncThreadPool(@RequestBody String threadPoolStr) {
        return configService.syncThreadPool(threadPoolStr);
    }

    @GetMapping("/event/queue")
    @ResponseBody
    public Result getEventQueue() {
        return configService.getEventQueue();
    }

}
